package com.lintf.nacos;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RefreshScope  // 添加此注解以支持动态刷新
public class UserController {

    @Value("${version:默认值}")  // 从 Nacos 中获取 k1 的值，如果不存在则使用默认值
    private String version;

    @GetMapping("/getConfig")
    public String getConfig() {
        System.out.println(version);
        return version;
    }

}